package com.gzsxy.dynamicProxy;

import com.gzsxy.proxy.Host;
import com.gzsxy.proxy.Rent;

/**
 * @author xiaolong
 * @version 1.0
 * @description: TODO
 * @date 2022/4/26 22:02
 */
public class Client {
    public static void main(String[] args) {
        //真实角色
//        Host host = new Host();
//        ProxyInvocationHandler pih = new ProxyInvocationHandler();
//        pih.setRent(host);
//        Rent proxy = (Rent)pih.getProxy();
//        proxy.rent();

        //可以使用多个代理的接口对象
        Host host = new Host();
        ProxyInvocationHandler1 pih = new ProxyInvocationHandler1();
        pih.setTarget(host);
        Rent proxy = (Rent)pih.getProxy();
        proxy.rent();

    }
}
